<?php

include 'DatabaseUtils.php';
//$databaseUtils=new DatabseUtils("../config/config_database.php");
////echo $databaseUtils->get("DB_TYPE");
////echo $databaseUtils->openConn();
//$result=$databaseUtils->operate_mysql();
////print_r($result);
test();
function test(){
	//testOperate_mysql();
	//testQueryAll_mysql();
	//testCount();
	//testGet();
	//testOpenConn();
	//testQueryAll();
	//testQueryAll_oracle();
	testOperate_oracle();
}

function testGet(){
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$result=$databaseUtils->get("DB_TYPE");
	print_r($result);
}
function testOpenConn(){
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$result=$databaseUtils->openConn();
	print_r($result);
}
function testQueryAll(){
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$conn=$databaseUtils->openConn();
	$query="select * from users";
	$result=$databaseUtils->queryAll($conn, $query);
	print_r($result);
}
function testQueryAll_oracle(){
	$query="select * from users";
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$databaseUtils->queryAll_oracle($query);
}

function testOperate_oracle(){
	$query="insert into users(id,name,password,des) values('3','username','password','des')";
	//$query="delete from users  where id=1";
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$databaseUtils->operate_oracle($query);
}

function testOperate_mysql(){
	//$query="insert into user(username,password) values('用户名','密码')";
	//$query="update user set username='修改' where id=4";
	//$query="delete from user  where id=4";
	$query="delete from user  where id=3";
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$databaseUtils->operate_mysql($query);
}


function testQueryAll_mysql(){
	$query="select count(*) from user";
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$result=$databaseUtils->queryAll_mysql($query);
	print_r($result);
}
function testCount(){
	$query="select count(*) from user";
	$databaseUtils=new DatabseUtils("../config/config_database.php");
	$result=$databaseUtils->count($query);
	print_r($result);
}

?>
